<?php 
    include_once('../includes/common.inc.php');
    include_once('../dal/adminDAL.php');
    if(check_login()==false){
        header("location:login.php");
        
    }
    $_title ="Thêm thành viên";
    
    //xu ly form

    $error_message="";
    $class = "";
    $message = "";
    if(isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["email"]) && isset($_POST["fullname"]))
    {      
        $adminDAL = new AdminDAL();
        $error_message = $adminDAL->insertMember($_POST);
        if($error_message == "")
        {
            $class = "message success";
            $message = "Bạn đã thêm tài khoản thành công";
        }
        else
        {
            $class = "message error";
            $message = $error_message;
        }
    }

    include_once('../views/admin/header.php');
    include_once('../views/admin/addmember.php');
    

?>